package com.emcom.gotour.utils;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class Paging implements Comparable<Object>, Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 8479597609173771305L;
	private int pageSize;
	private int currentPage;
	private int allPage;
	private int resultSize;
	private int prePage;
	private int nextPage;
	private int firstPage;
	private int lastPage;
	private List<?> objectList;
	private List<?> pagingList;
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getAllPage() {
		return allPage;
	}
	public void setAllPage(int allPage) {
		this.allPage = allPage;
	}
	public int getResultSize() {
		return resultSize;
	}
	public void setResultSize(int resultSize) {
		this.resultSize = resultSize;
	}
	public int getPrePage() {
		return prePage;
	}
	public void setPrePage(int prePage) {
		this.prePage = prePage;
	}
	public int getNextPage() {
		return nextPage;
	}
	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}
	public int getFirstPage() {
		return firstPage;
	}
	public void setFirstPage(int firstPage) {
		this.firstPage = firstPage;
	}
	public int getLastPage() {
		return lastPage;
	}
	public void setLastPage(int lastPage) {
		this.lastPage = lastPage;
	}
	public List<?> getObjectList() {
		return objectList;
	}
	public void setObjectList(List<?> objectList) {
		this.objectList = objectList;
	}
	public List<?> getPagingList() {
		return pagingList;
	}
	public void setPagingList(List<?> pagingList) {
		this.pagingList = pagingList;
	}
	/**
	 * @see java.lang.Comparable#compareTo(Object)
	 */
	public int compareTo(Object object) {
		Paging myClass = (Paging) object;
		return new CompareToBuilder().append(this.prePage, myClass.prePage)
				.append(this.lastPage, myClass.lastPage).append(this.nextPage,
						myClass.nextPage).append(this.pageSize,
						myClass.pageSize).append(this.firstPage,
						myClass.firstPage).append(this.objectList,
						myClass.objectList).append(this.currentPage,
						myClass.currentPage).append(this.pagingList,
						myClass.pagingList).append(this.resultSize,
						myClass.resultSize).append(this.allPage,
						myClass.allPage).toComparison();
	}
	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof Paging)) {
			return false;
		}
		Paging rhs = (Paging) object;
		return new EqualsBuilder().appendSuper(super.equals(object)).append(
				this.prePage, rhs.prePage).append(this.lastPage, rhs.lastPage)
				.append(this.nextPage, rhs.nextPage).append(this.pageSize,
						rhs.pageSize).append(this.firstPage, rhs.firstPage)
				.append(this.objectList, rhs.objectList).append(
						this.currentPage, rhs.currentPage).append(
						this.pagingList, rhs.pagingList).append(
						this.resultSize, rhs.resultSize).append(this.allPage,
						rhs.allPage).isEquals();
	}
	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(2001748581, 1352129923).appendSuper(
				super.hashCode()).append(this.prePage).append(this.lastPage)
				.append(this.nextPage).append(this.pageSize).append(
						this.firstPage).append(this.objectList).append(
						this.currentPage).append(this.pagingList).append(
						this.resultSize).append(this.allPage).toHashCode();
	}
	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("firstPage", this.firstPage)
				.append("objectList", this.objectList).append("prePage",
						this.prePage).append("allPage", this.allPage).append(
						"currentPage", this.currentPage).append("pageSize",
						this.pageSize).append("pagingList", this.pagingList)
				.append("resultSize", this.resultSize).append("lastPage",
						this.lastPage).append("nextPage", this.nextPage)
				.toString();
	}
}
